﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;

namespace Bitcoin.Net
{
    /// <summary>
    /// Facade to provide .NET Framework implmentation of portable IDnsService.
    /// </summary>
    public class FrameworkDnsService : IDnsService
    {
        public IEnumerable<NetAddress> GetAddressList(string hostName)
        {
            var hostEntry = Dns.GetHostEntry(hostName);
            foreach (var ipAddress in hostEntry.AddressList)
            {
                var bytes = ipAddress.GetAddressBytes();
                yield return new NetAddress(bytes);
            }
        }
    }
}
